//
//  MCNewMessageAlertViewController.m
//  MicroChat
//
//  Created by Mac on 2018/5/29.
//  Copyright © 2018年 stoneobs.qq.com. All rights reserved.
//

#import "MCNewMessageAlertViewController.h"

@interface MCNewMessageAlertViewController ()
@property(nonatomic, strong) NSArray                     *dataSouce;/**< 数据源 */
@property(nonatomic, strong) UISwitch                     *reciveSwitch;/**< 接受 */
@property(nonatomic, strong) UISwitch                     *voiceSwitch;/**< 声音 */
@property(nonatomic, strong) UISwitch                     *shakeSwitch;/**< 震动 */
@end

@implementation MCNewMessageAlertViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"新消息提醒";
    [self configDataSouce];
    // Do any additional setup after loading the view.
}
- (UISwitch*)defultSwitch{
    UISwitch * swicthView = [UISwitch new];
    swicthView.onTintColor = TM_ThemeBackGroundColor;
    [swicthView addTarget:self action:@selector(onSelctedSwitch:) forControlEvents:UIControlEventValueChanged];
    return swicthView;
}
- (void)configDataSouce{
    self.reciveSwitch = [self defultSwitch];
    self.voiceSwitch = [self defultSwitch];
    self.shakeSwitch = [self defultSwitch];
    self.dataSouce = @[
                       [[STTableEasyModel alloc] initWithTextString:@"接受新消息通知"
                                                      accessoryView:self.reciveSwitch],
                       [[STTableEasyModel alloc] initWithTextString:@"声音"
                                                      accessoryView:self.voiceSwitch],
                       [[STTableEasyModel alloc] initWithTextString:@"震动"
                                                      accessoryView:self.shakeSwitch]
                       ];
    [self.tableView reloadData];
}
#pragma --mark UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return self.dataSouce.count ;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return 50;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    
    return 10;
}
- (UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    return [UIView new];
}
- (UIView*)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    return [UIView new];
}
- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    static NSString * reuseIdentifier =  @"cell";
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier];
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier];
        
    }
    STTableEasyModel * mdoel = self.dataSouce[indexPath.row];
    [cell setSt_tableEasyModel:mdoel];
    return cell;
}
#pragma --mark UITableViewDelegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    [tableView deselectRowAtIndexPath:indexPath animated:NO];
}

#pragma mark --Action Method
- (void)onSelctedSwitch:(UISwitch*)sender{
    
}
@end
